package com.lzdongrui.client.controller;

import com.lzdongrui.backend.domain.Eliminate;
import com.lzdongrui.backend.domain.dto.EliminateDTO;
import com.lzdongrui.backend.service.IEliminateService;
import com.lzdongrui.common.core.controller.BaseController;
import com.lzdongrui.common.core.domain.AjaxResult;
import com.lzdongrui.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/client/eliminate")
public class ClientEliminateController extends BaseController {

    @Autowired
    private IEliminateService eliminateService;

    @RequestMapping
    public TableDataInfo selectEliminateList(EliminateDTO eliminate) {
        startPage();
        return getDataTable(eliminateService.selectEliminateList(eliminate));
    }

    @GetMapping(value = "/{id}")
    public AjaxResult selectEliminateInfo(@PathVariable("id") Long id) {
        return success(eliminateService.selectEliminateById(id));
    }

    @PostMapping
    public AjaxResult addEliminateInfo(@RequestBody Eliminate eliminate) {
        return toAjax(eliminateService.insertEliminate(eliminate));
    }
}
